function createHttpRequest(){
	var xmlHttpRequest = null;
	
	if(window.XMLHttpRequest){
		xmlHttpRequest = new XMLHttpRequest;
	}else if(window.ActiveXObject){
		var activexName = ["MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
		for(var i = 0; i < activexName.length; i++){
			try{
				xmlHttpRequest = new ActiveXObject(activexName[i]);
				if(xmlHttpRequest){
					break;
				}
			}catch(e){
				
			}
			
		}
	}
	
}

function get(){
	var req = createHttpRequest();
	if(req){
		req.open("GET", "Servlet", true);
		req.onreadychange=function(){
			if(req.readyStatus == 4 && req.status == 200){
				var json = JSON.parse(req.responseText());
			}
		}
		
		req.send(null);
	}
	
}

function post(){
	var req = createHttpRequest();
	if(req){
		req.open("POST", "Servlet", true);
		req.setRequestHeader("Content-Type",
		"application/x-www-form-urlencoded; charset=gbk;");
		req.onreadychange=function(){
			if(req.readyStatus == 4 && req.status == 200){
				var json = JSON.parse(req.responseText());
			}
		}		
		req.send("keywords=手机");
	}
	
}